<%@ page contentType="text/html; charset=utf-8" language="java"%>
<%@ taglib prefix="s" uri="/WEB-INF/struts-tags.tld"%>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="pragma" content="no-cache" />
		<title>欢迎访问产品运营互动中心！</title>
		<link rel="stylesheet" href="<s:url value="/css/style_new.css"/>">
		<link href="<s:url value="/images/08_ccxxzx.css"/>" rel="stylesheet"
			type="text/css" />
		<script type="text/javascript"
	src="<s:url value="/script/easyajax.js"/>"></script>
		<script type="text/javascript"
			src="<s:url value="/script/selfResize.js"/>"></script>
		<script>
function initLoad(){
	f_iframeResize();
}
window.onload = initLoad;
window.setInterval("initLoad()", 200);
function del(id){
    var talbeObj=event.srcElement.parentElement.parentElement.parentElement.parentElement;
	if (confirm("删除产品资料将删除资料及相关附件信息，确定删除吗？")){
		var url='su_delProductReference.action?productReference.id='+id;
		callSynchronized(url,function(XML){//同步调用
		    if($$(XML.responseXML,"str")=="true"){
		        talbeObj.style.display="none";
		    	alert("产品资料删除成功");
		    }else{
		    	alert("产品资料删除失败");
		    }
		});
	}
}
function process(){
		b_setDisable(document.getElementById("Submit"));
}
</script>
	</head>
	<body bgcolor="#FFFFFF" leftmargin="0" style="margin:0px" topmargin="0">
								<s:form id="form1" action="/business/product/su_modProduct.action"
									namespace="/business/catalog" enctype="multipart/form-data"
									method="post" onsubmit="process();">
		<input type="hidden" name="product.id" value="${product.id}">
		<input type="hidden" name="addInfos">
		<input type="hidden" name="addValues">
		<input type="hidden" name="product.creator" value="${product.creator}">
		<input type="hidden" name="product.begin" value="${product.begin}">
		<input type="hidden" name="product.end" value="${product.end}">
		<input type="hidden" name="conds.sortType" value="${conds.sortType}">
		<input type="hidden" name="product.isNew" value="${product.isNew}">
		<input type="hidden" name="product.name" value="${product.name}">
		<input type="hidden" name="product.reqCode" value="${product.reqCode}">
		<input type="hidden" name="product.isClient" value="${product.isClient}">
		<input type="hidden" name="product.procinstId" value="${product.procinstId}">		
		<s:set name="st" value="conds.sortType"></s:set>
		<table width="98%" border="0" cellspacing="0" align="center"
			cellpadding="0">
			<tr>
				<td valign="top">
					<table width="100%" height="100%" border="0" align="center"
						cellpadding="0" cellspacing="0" style="margin-top:5px">
						<tr>
							<td>
								<table width="100%" border="0" cellpadding="0" cellspacing="0"
									background="<s:url value="/images/cpxxym_4.gif"/>">
									<tr>
										<td width="39">
											<img src="<s:url value="/images/cpxxym_3.gif"/>" width="39"
												height="25" alt="" />
										</td>
										<td width="215">
											产品首页：<a href="<s:url value="/business/product/su_editProduct.action" />?product.id=${product.id}">${product.name}</a>
										</td>
										<td >
											<input type="Submit" id="Submit" name="Submit" value="保 存">
										</td>
									</tr>
								</table>
								<table width="99%" border="0" align="center" cellpadding="0"
									cellspacing="0">
									<tr>
										<td background="<s:url value="/images/cpxxym_11.gif"/>">
											<img src="<s:url value="/images/cpxxym_9.gif"/>" width="414"
												height="32" alt="" />
										</td>
									</tr>
									<tr>
										<td style="padding:5px">
												<s:textarea rows="3" cols="88" name="product.briefIntroduction" theme="css_xhtml"></s:textarea>
										</td>
									</tr>
								</table>
								
								<table width="99%" border="0" align="center" cellpadding="0"
									cellspacing="0">
									<tr>
										<td background="<s:url value="/images/cpxxym_14.gif"/>">
											<img src="<s:url value="/images/cpxxym_13.gif"/>" width="414"
												height="32" alt="" />
										</td>
									</tr>
									<tr>
										<td style="padding:5px">

												<s:textarea name="product.description" cols="88" rows="6" theme="css_xhtml"></s:textarea>
										</td>
									</tr>
								</table>
								<table width="99%" border="0" align="center" cellpadding="0"
									cellspacing="0">
									<tr>
										<td colspan="2"
											background="<s:url value="/images/cpxxym_17.gif"/>">
											<img src="<s:url value="/images/cpxxym_16.gif"/>" width="414" height="32" alt="" />
										</td>
									</tr>
									<tr>
										<td width="20%" style="padding:5px">
											<s:iterator id="attach" value="attachs">
												<img
													src="<s:url value="/common/showImg!showImg.action?imgWidth=160&imgHeight=120&attach.id="/><s:property value="id"/>"
													onclick="window.open('<s:url value="/common/showImgFile.action?attach.id="/><s:property value="id"/>','','')"
													style="cursor:hand" alt="点击查看原图" />
											</s:iterator>
											
										</td>
									</tr>
													<tr>
														<td width="100%">
				&nbsp;<a href="javascript:void(0);" onclick="dispItem(document.all['picEdit']);">图片编辑</a>
								
								<table id="picEdit" width="99%" border="0" align="center" cellpadding="0" cellspacing="0" style="display:none;">
													<tr>
														<td width="19%">
															<div align="right" class="STYLE2">
																产品图片：
															</div>
														</td>
														<td width="81%">
															<table width="98%" border="0" class=tablecolor2>
																<tr>
																	<td width="" align="center" bgcolor="D6E3FA">
																		附件名称
																	</td>
																	<td width="50" align="center" bgcolor="D6E3FA">
																		删除
																	</td>
																</tr>
																<s:iterator id="attach" value="attachs">
																	<input type="hidden" name="attachIDs"
																		value="<s:property value="id" />" />
																	<tr>
																		<td>
																			<a
																				href="<s:url value="/common/showFile.action?attach.id="/><s:property value="id" />"
																				target="_blank"> <s:property value="fullName" />
																			</a>
																		</td>
																		<td align="center">
																			<input type="checkbox" name="delIDs"
																				value="<s:property value="id" />">
																		</td>
																	</tr>
																</s:iterator>
															</table>
															<br />
															<table width="98%" border="0" class=tablecolor2>
																<tr>
																	<td width="98%" colspan="2">
																		&nbsp;
																		<font color="red">注：只限于上传img、jpg、gif等图片格式文件，大小限制为10M.</font>
																	</td>
																</tr>
																<tr>
																	<td width="10px">
																		&nbsp;
																	</td>
																	<td align="left">
																		<input type="file" name="upload" size="40" />
																	</td>
																</tr>
																<tr>
																	<td>
																		&nbsp;
																	</td>
																	<td>
																		<input type="file" name="upload" size="40" />
																	</td>
																</tr>
																<tr>
																	<td>
																		&nbsp;
																	</td>
																	<td>
																		<input type="file" name="upload" size="40" />
																	</td>
																</tr>
															</table>
														</td>
													</tr>
									
													<tr>
														<td>
															<div align="right">
																访问地址：
															</div>
														</td>
														<td>
															<s:textfield name="product.linkUrl" theme="css_xhtml" size="75" />
														</td>
													</tr>
								</table>
								
								
								
														</td>
													</tr>
								</table>
								<table width="99%" border="0" align="center" cellpadding="0"
									cellspacing="0">
									<tr>
										<td background="<s:url value="/images/cpxxym_20.gif"/>">
											<img src="<s:url value="/images/cpxxym_19.gif"/>" width="414"
												height="32" alt="" />
										</td>
									</tr>
									<tr>
										<td valign="top" style="padding:5px">
											
											
											
											<table width="98%" border="0" cellspacing="0" cellpadding="0">
												<tr>
													<td height="20" colspan="4"
														background="<s:url value="/images/cpxxym_23.gif"/>">
														&nbsp;主要负责人：
													</td>
													
												</tr>
												<s:iterator id="mainPersonInfo" value="lMainPerson">
													<tr>
														<td width="24%" height="25">
															&nbsp;联系人：
															<s:property value="name" /><input type="hidden" name="mainPersons" value="${id}">
														</td>
														<td width="27%">
															电子邮箱：
														</td>
														<td width="24%">
															手机：
														</td>
														<td>
															办公电话：
														</td>
													</tr>
												</s:iterator>

												<tr>
													<td height="20" colspan="4"
														background="<s:url value="/images/cpxxym_23.gif"/>">
														&nbsp;其他负责人：
													</td>
												</tr>
												<s:iterator id="genPerson" value="lGenPersons">
													<tr>
														<td width="24%" height="25">
															&nbsp;联系人：
															<s:property value="name" /><input type="hidden" name="persons" value="${id}">
														</td>
														<td width="27%">
															电子邮箱：
															<s:iterator id="genLinkMethod" value="linkMethods">
																<s:if test="type=='电子邮箱'">
																	<s:property value="value" />
																</s:if>
															</s:iterator>
														</td>
														<td width="24%">
															手机：
															<s:iterator id="genLinkMethod" value="linkMethods">
																<s:if test="type=='手机'">
																	<s:property value="value" />
																</s:if>
															</s:iterator>
														</td>
														<td>
															办公电话：
															<s:iterator id="genLinkMethod" value="linkMethods">
																<s:if test="type=='办公电话'">
																	<s:property value="value" />
																</s:if>
															</s:iterator>
														</td>
													</tr>
												</s:iterator>
												

											</table>
										</td>
									</tr>
								</table>
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
		<table width="98%" border="0" cellpadding="0" cellspacing="0" background="<s:url value="/images/cpxxym_4.gif"/>">
			<tr>
				<td width="40">
					<img src="<s:url value="/images/cpxxym_3.gif"/>" width="39"
						height="25" alt="" />
				</td>
				<td  width="185">
					产品资料：
				</td>
				<td>
					 <a href="su_editProductReference.action?product.id=${product.id}">新增</a>
				</td>
				<td align="right">&nbsp;
					<a href="javascript:void(0);" onclick="document.all['refDiv'].style.display='';window.setTimeout('window.parent.changeScroll()',500)">更多相关资料&gt;&gt;</a></td>
			</tr>
		</table>
		<s:if test="productReferences.size==0">
			<table align="center">
				<tr>
					<!--td>
						&lt;暂无&gt;
					</td-->
				</tr>
			</table>
		</s:if>
		<s:iterator id="pr" value="productReferences" status="st">
			<table width="98%" border="0" align="center" cellpadding="0"
				cellspacing="0">
				<br>
				<s:if test="#st.modulus(4)==1">
					<tr>
						<td class="cpst_zxcp1" width="160">
							<s:property value="referenceType.name" />
						</td>
						<td> <a href="su_editProductReference.action?productReference.id=${id}&product.id=${product.id}">编辑</a>&nbsp;&nbsp;<a  href="javascript:" onclick="del('${id}')">删除</a></td>
					</tr>
					<tr>
						<td width="30%" bgcolor="3D4782" height="3">
						</td>
						<td width="30%" bgcolor="8BB0DA">
						</td>
						<td bgcolor="D5E2F2">
						</td>
					</tr>
				</s:if>
				<s:elseif test="#st.modulus(4)==2">
					<tr >
						<td class="cpst_zxcp2">
							<s:property value="referenceType.name" />
						</td>
						<td> <a href="su_editProductReference.action?productReference.id=${id}&product.id=${product.id}">编辑</a>&nbsp;&nbsp;<a  href="javascript:" onclick="del('${id}')">删除</a></td>
					</tr>
					<tr>
						<td width="30%" bgcolor="F26F1F" height="3">
						</td>
						<td width="30%" bgcolor="FDB813">
						</td>
						<td bgcolor="FEF200">
						</td>
					</tr>
				</s:elseif>
				<s:elseif test="#st.modulus(4)==3">
					<tr >
						<td class="cpst_zxcp3">
							<s:property value="referenceType.name" />
						</td>
						<td> <a href="su_editProductReference.action?productReference.id=${id}&product.id=${product.id}">编辑</a>&nbsp;&nbsp;<a  href="javascript:" onclick="del('${id}')">删除</a></td>
					</tr>
					<tr>
						<td width="30%" bgcolor="00A650" height="3">
						</td>
						<td width="30%" bgcolor="70BE44">
						</td>
						<td bgcolor="BED82F">
						</td>
					</tr>
				</s:elseif>
				<s:else>
					<tr>
						<td class="cpst_zxcp4">
							<s:property value="referenceType.name" />
						</td>
						<td> <a href="su_editProductReference.action?productReference.id=${id}&product.id=${product.id}">编辑</a>&nbsp;&nbsp;<a  href="javascript:" onclick="del('${id}')">删除</a></td>
					</tr>
					<tr>
						<td width="30%" bgcolor="0C6084" height="3">
						</td>
						<td width="30%" bgcolor="159DC3">
						</td>
						<td bgcolor="B0CED8">
						</td>
					</tr>
				</s:else>
				<tr style="display:">
					<td colspan="3">
						<s:iterator value="attachs">
							<div style="margin-left:50px">
														<s:if test="saveType != 2">
														<s:if test="isFtp != 1">
															<a href="<s:url value="/common/showFile.action?attach.id="/><s:property value="id" />"
																target="_blank">
																<font color="blue"><s:property value="fullName" /></font>
															</a>
														</s:if>
														<s:if test="isFtp == 1">
															<a href="<s:url value="/common/showFtpFile.action?attach.id="/><s:property value="id" />"
																target="_blank">
																<font color="blue"><s:property value="fullName" /></font>
															</a>
														</s:if>
														</s:if>
														<s:else>
															<a href="<s:url value="/common/showFile.action?attach.id="/><s:property value="id" />"
																target="_blank">
																<font color="blue"><s:property value="name" /></font>
															</a>
														</s:else>
							</div>
						</s:iterator>
					</td>
				</tr>
			</table>
		</s:iterator>
													<s:iterator id="info" value="product.productInfos">
														<tr>
															<td align="right" bgcolor="D6E3FA">
																<input type="hidden" name="infoIds"
																	value="<s:property value="productProperty" />" />
																<input type="hidden" name="propertyValue"
																	value="<s:property value="propertyValue" />" />
															</td>
														</tr>
													</s:iterator>
													
		<div id="refDiv" name="refDiv" valign="top" style="WIDTH: 100%;  display:none;">
		<s:iterator id="pr" value="lRefType" status="st">
			<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
				<br>
				<s:if test="#st.modulus(4)==1">
					<tr>
						<td class="cpst_zxcp1" width="160">
							<s:property value="name" />
						</td>
						<td> <a href="su_editProductReference.action?referenceTypeId=${id}&product.id=${product.id}">新增</a></td>
					</tr>
					<tr>
						<td width="30%" bgcolor="3D4782" height="3">
						</td>
						<td width="30%" bgcolor="8BB0DA">
						</td>
						<td bgcolor="D5E2F2">
						</td>
					</tr>
				</s:if>
				<s:elseif test="#st.modulus(4)==2">
					<tr >
						<td class="cpst_zxcp2">
							<s:property value="name" />
						</td>
						<td> <a href="su_editProductReference.action?referenceTypeId=${id}&product.id=${product.id}">新增</a></td>
					</tr>
					<tr>
						<td width="30%" bgcolor="F26F1F" height="3">
						</td>
						<td width="30%" bgcolor="FDB813">
						</td>
						<td bgcolor="FEF200">
						</td>
					</tr>
				</s:elseif>
				<s:elseif test="#st.modulus(4)==3">
					<tr >
						<td class="cpst_zxcp3">
							<s:property value="name" />
						</td>
						<td> <a href="su_editProductReference.action?referenceTypeId=${id}&product.id=${product.id}">新增</a></td>
					</tr>
					<tr>
						<td width="30%" bgcolor="00A650" height="3">
						</td>
						<td width="30%" bgcolor="70BE44">
						</td>
						<td bgcolor="BED82F">
						</td>
					</tr>
				</s:elseif>
				<s:else>
					<tr>
						<td class="cpst_zxcp4">
							<s:property value="name" />
						</td>
						<td> <a href="su_editProductReference.action?referenceTypeId=${id}&product.id=${product.id}">新增</a></td>
					</tr>
					<tr>
						<td width="30%" bgcolor="0C6084" height="3">
						</td>
						<td width="30%" bgcolor="159DC3">
						</td>
						<td bgcolor="B0CED8">
						</td>
					</tr>
				</s:else>
			</table>
		</s:iterator>
		</div>
		
</s:form>
	</body>
</html>
<script>
function selectMainPerson(){
    var url="<s:url value='/' escapeAmp='false'/>"+"organ/toOrganTree.action?type=&path=toPersonTree&module=radio&date=<%=System.currentTimeMillis()%>";	 var returnData=window.showModalDialog(url,window,"status:no;dialogWidth:650px;dialogHeight:600px;scroll:yes;");
	 if(returnData){
	 	document.forms[0]["mainPersonNames"].value=returnData[1];
	 	document.forms[0]["mainPersons"].value=returnData[0];
	 }
}
function selectPerson(){
    var url="<s:url value='/' escapeAmp='false'/>"+"organ/toOrganTree.action?type=&path=toPersonTree&module=checkbox&date=<%=System.currentTimeMillis()%>";
	 var returnData=window.showModalDialog(url,window,"status:no;dialogWidth:650px;dialogHeight:600px;scroll:yes;");
	 if(returnData){
	 	document.forms[0]["personNames"].value=returnData[1];
	 	document.forms[0]["persons"].value=returnData[0];
	 }
}

function checkFile()   
{   
  var obj=document.all["upload"];
  var s=true;
  if (obj){
	  var len=obj.length;
	  if (len){
		  if (len==1){
			  f=obj.value;
			  if (f!=""){
				  s=checkFileType(f);	
				  if (!s) {
					  alert("上传文件是限制文件类型文件");
					  obj[i].focus();
					  return false;	
				  }	
			  }
		  }else if (len>1){
			  for (i=0;i<len;i++){
				  f=obj[i].value;
				  if (f!=""){
					  s=checkFileType(f);	
					  if (!s) {
						  alert("上传文件是限制文件类型文件");
						  obj[i].focus();
						  return false;	
					  }		
				  }  
			  }
		  }
	  }
  }
  return s;  
} 

function checkFileType(sfile){
	  sfile=sfile.substr(sfile.lastIndexOf(".")+1)   
	  if(sfile!="img" && sfile!="jpg" && sfile!="gif")   
	  {    
	  	return false;   
	  } 
	  return true; 
}

function save(){
	var propertyValues=document.getElementsByName("propertyValue");
	var infoIds=document.getElementsByName("infoIds");
	form1.addInfos.value="";
	form1.addValues.value="";
	var spaceNum=0;
	for(i=0;i<propertyValues.length;i++){
	    if(propertyValues[i].value!=""){
			form1.addInfos.value+=infoIds[i].value+",";
			form1.addValues.value+=propertyValues[i].value+",";
		}else{
			spaceNum++;
		}
	}

	form1.addInfos.value=form1.addInfos.value.substring(0,form1.addInfos.value.length-1);
	form1.addValues.value=form1.addValues.value.substring(0,form1.addValues.value.length-1);

	if (!checkFile()) return false;
	document.all['form1'].submit();
}

function dispItem(obj){
	if(obj.style.display==''){
		obj.style.display='none';
	}else{
		obj.style.display='';
	}
	window.setTimeout('window.parent.changeScroll()',500);
}
</script>